import json
import unittest
from parameterized import parameterized
# 待 测试方法

def add(x, y):
    return x + y

def read_json_data():
    list_data = []
    with open("./unittest_json.json", "r", encoding="utf-8") as f:
        data = json.load(f)

        for tmp in data:
            list01 = tuple(tmp.values())
            list_data.append(list01)

        return list_data


class TestAdd(unittest.TestCase):
    @parameterized.expand(read_json_data())
    def test01_add(self, x, y, except_data):
        res = add(x, y)
        self.assertEqual(except_data, res)
